<!-- 运送详情 》 工单底部 -->

<script>
// ============================== 导入依赖 ============================== //

import CORE from '@/CORE'
import RepairFooter from '@admin/components/detail/DetailRepair/RepairFooter'

// ============================== 导出组件 ============================== //

export default CORE.extend(RepairFooter, {
  /**
   * 名称定义 (实际使用名称)
   */
  name: 'DeliverFooter',

  /**
   * 混入列表 (配置选项合并)
   */
  mixins: [
    CORE.mixWeb(),
    CORE.mixWeb('deal', 'deal_'),
  ],

  /**
   * 本地方法 (轻量重要在前)
   */
  methods: {
    ...RepairFooter.methods,

    /**
     * 打开处理弹窗
     */
    openDeal(one, dealKey = 'deal') {
      const { MAP } = this
      const DEAL = MAP[one.status][dealKey]

      const obj = { workOrderId: one.id, ...MAP[DEAL] }

      if (['ASSIGN', 'FORWARD'].includes(DEAL)) {
        const [, organId, uaaUserId, name, phone] = ['', '', '', '', '', '']
        CORE.merge(obj, {
          assignUserId: uaaUserId,
          assignUserName: name,
          assignUserPhone: phone,
          user: { uaaUserId, name, phone, organId: [organId] }, // 指派人
        })
      }

      this.deal_MAP.tipEdit = obj.operate

      this.deal_openEdit(obj)
    },
  },
})
</script>
